#define _GNU_SOURCE
#include "app_pool.h"
#include "log/log.h"
#include "unistd.h"
#include "stdlib.h"

// 该函数将在线程池中某个线程执行
int app_task_fun(void *arg)
{
    log_debug("task fun (%d) 执行， arg=%s", gettid(), (char *)arg);
    return 0;
}
int main()
{
    app_pool_init(4);
    // 向消息队列发送任务
    for (int i = 0; i < 10; i++)
    {
        char *data = malloc(sizeof(char) * 10);
        sprintf(data, "task_%d", i);
        app_pool_registerTask(app_task_fun, data);
    }
    sleep(1);
    app_pool_destroy();
    return 0;
}